package com.jy.wms.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.jy.wms.common.base.BaseController;
import com.jy.wms.common.base.JsonResult;
import com.jy.wms.pojo.WmsArtificialReplenishmentStock;
import com.jy.wms.service.WmsArtificialReplenishmentStockService;
import javax.servlet.http.HttpSession;
import com.github.pagehelper.Page;
import com.jy.wms.common.base.ResultPage;
import java.util.List;
import com.jy.wms.common.UUIDUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/**
 * @ClassName: WmsArtificialReplenishmentStockController
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @Author LH
 * @Date Mon Nov 27 17:25:29 GMT+08:00 2017
 */
@RestController
@RequestMapping("/wmsartificialreplenishmentstock")
@Api(value = "/wmsartificialreplenishmentstock", description = "人工驱动补货库存记录")
public class  WmsArtificialReplenishmentStockController extends BaseController<WmsArtificialReplenishmentStockService,WmsArtificialReplenishmentStock> {

    @PostMapping(value = {"list", ""})
    @ApiOperation(value = "查询信息",response = JSONObject.class, notes = "查询信息")
    public @ResponseBody ResultPage<WmsArtificialReplenishmentStock> getWmsArtificialReplenishmentStock(@RequestBody WmsArtificialReplenishmentStock entity,HttpSession session) {
        Page<WmsArtificialReplenishmentStock> list= baseService.baseSelectPage(entity);
            return renderPage(list);
    }

    @PostMapping(value = "delete")
    @ApiOperation(value = "删除信息",response = JSONObject.class, notes = "删除信息")
    public @ResponseBody JsonResult deleteWmsArtificialReplenishmentStock(@RequestBody List<String> ids) {
        Integer flag=baseService.baseDeleteBathPrimaryKeys(ids);
        return renderSuccess("删除成功");
    }

    @PostMapping(value = "add")
    @ApiOperation(value = "新增信息",response = JSONObject.class, notes = "新增信息")
    public @ResponseBody JsonResult addWmsArtificialReplenishmentStock(@RequestBody WmsArtificialReplenishmentStock entity) {
        entity.setId(UUIDUtils.uuid());
        baseService.baseInsert(entity);
        return renderSuccess("添加成功");
    }

    @GetMapping(value = "getWmsArtificialReplenishmentStock/{id}")
    @ApiOperation(value = "查看单个信息",response = JSONObject.class, notes = "GET查看单个信息")
    public @ResponseBody WmsArtificialReplenishmentStock getWmsArtificialReplenishmentStockById(@PathVariable("id") String id) {
        WmsArtificialReplenishmentStock entity=baseService.baseSelectByPrimaryKey(id);
        return entity;
    }
    @PostMapping(value = "edit")
    @ApiOperation(value = "编辑信息",response = JSONObject.class, notes = "编辑信息")
    public @ResponseBody JsonResult editWmsArtificialReplenishmentStock(@RequestBody WmsArtificialReplenishmentStock entity) {
        Integer flag=baseService.baseUpdateByPrimaryKeySelective(entity);
        return renderSuccess("修改成功");
    }
}
